﻿using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using static System.Runtime.CompilerServices.RuntimeHelpers;

namespace WinForm_Mes.WorkingManagement.Technological
{
    public partial class UpdateTechnologicalForm : DevExpress.XtraEditors.XtraForm
    {
        private TechnologicalFlowItem _item;

        public UpdateTechnologicalForm(TechnologicalFlowItem item)
        {
            InitializeComponent();
            _item = item;
            // 反显
            textEdit1.Text = item.TechnologicalCode;
            textEdit2.Text = item.TechnologicalName;
            radioGroup1.EditValue = item.IsEnabled;
            memoEdit1.Text = item.TechnologicalDescription;
            memoEdit2.Text = item.Remarks;
        }

        private void btnUpdate_Click(object sender, EventArgs e)
        {
            _item.TechnologicalCode = textEdit1.Text.Trim();
            _item.TechnologicalName = textEdit2.Text.Trim();
            _item.IsEnabled = (bool)radioGroup1.EditValue;
            _item.TechnologicalDescription = memoEdit1.Text.Trim();
            _item.Remarks = memoEdit2.Text.Trim();

            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        public TechnologicalFlowItem GetItem()
        {
            return _item;
        }

        private void UpdateTechnologicalForm_Load(object sender, EventArgs e)
        {

        }
    }
}